
// itemId - iconPath
var itemPathConfig = {
    100001: {path:"icon/icon-01", power: 2, strength: 3, wit: 4, luck: 5},
    100002: {path:"icon/icon-01", power: 3, strength: 4, wit: 2, luck: 5},
    200001: {path:"icon/icon-02", power: 4, strength: 5, wit: 3, luck: 5},
    200002: {path:"icon/icon-02", power: 5, strength: 2, wit: 4, luck: 5},
    300001: {path:"icon/icon-03", power: 2, strength: 3, wit: 5, luck: 5},
    300002: {path:"icon/icon-03", power: 3, strength: 4, wit: 4, luck: 5},
    400001: {path:"icon/icon-04", power: 4, strength: 5, wit: 5, luck: 5},
    400002: {path:"icon/icon-04", power: 5, strength: 2, wit: 2, luck: 5},
    500001: {path:"icon/icon-05", power: 2, strength: 3, wit: 1, luck: 5},
    500002: {path:"icon/icon-05", power: 3, strength: 3, wit: 2, luck: 5},
};

var item = function(itemCofnig) {
    this.valid = itemCofnig.valid;
    this.locked = itemCofnig.locked;
    this.tokenId = itemCofnig.tokenId;
    this.itemId = itemCofnig.itemId;
    this.useCount = itemCofnig.useCount || 1;
    this.owner = itemCofnig.owner;
    // this.power = itemCofnig.power;
    // this.strength = itemCofnig.strength;
    // this.wit = itemCofnig.wit;
    // this.luck = itemCofnig.luck;

    Object.defineProperties(this, {
        "iconPath": {
            get: function() {
                return itemPathConfig[this.itemId].path || itemPathConfig[100001].path;
            }
        },
        "power": {
            get: function() {
                return itemPathConfig[this.itemId].power || 0;
            }
        },
        "strength": {
            get: function() {
                return itemPathConfig[this.itemId].strength || 0;
            }
        },
        "wit": {
            get: function() {
                return itemPathConfig[this.itemId].wit || 0;
            }
        },
        "luck": {
            get: function() {
                return itemPathConfig[this.itemId].luck || 0;
            }
        }
    });
};

module.exports = item;